<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<!-- 

    <!-- 

        利用with关键字同时操作对象的多个属性

        with( 对象名){
            属性名=属性值；
            属性名=属性值；
        }

     -->
-->

<body>
    <script>
        var car = {
                brand: '宝马',
                price: 60000,
                run: function() {
                    console.log('汽车跑起来了');
                }
            }
            //with关键字可以对多个属性同时进行修改
        with(car) {
            brand = 'QQ',
                price = 3000,
                run = function() {
                    console.log('helloworld');
                }
        }
        console.log(car);

        //Object.keys(对象的名称)获取到所有的键

        console.log(Object.keys(car));

        //Object.values()获取到所有的值
        console.log(Object.values(car));

        //Object.entries()获取到所有的键值对
        console.log(Object.entries(car));
    </script>
</body>

</html>